@import "../style/globals.scss";
@import "./markdown-twoslash.scss";

.markdown {
  scroll-behavior: smooth;

  h1,
  h2,
  h3 {
    display: flex;
    flex-wrap: wrap;
    font-weight: 400;
    line-height: 1.3;
    white-space-collapse: preserve;

    a {
      padding-right: 10px !important;
    }

    &[id]::before {
      content: "";
      display: block;
      visibility: hidden;
      height: 30px;
      margin-top: -30px;
    }
  }

  h1 {
    margin-bottom: 12px;
    font-size: 2rem;
    margin-top: 0;
    word-wrap: break-word;
    word-break: break-word;
  }

  h2 {
    font-size: 1.75rem;
    margin-bottom: 12px;
    margin-top: 32px;
  }

  h3 {
    font-size: 1.1875rem;
    margin-top: 30px;
    margin-bottom: 18px;
  }

  pre {
    clear: both;
    top: 10px;
  }

  blockquote {
    border-left: 2px solid var(--border-color);
    background-color: var(--inline-code-background-color);
    font-size: 0.8rem;
    margin: auto;
    padding: 0.1rem 2rem;

    &.bg-reading {
      float: right;
      margin-left: 0.5rem;
      border-left: none;
    }
  }

  .language-id {
    display: none;
  }

  table {
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
    display: block;
    table-layout: auto;
    font-size: 0.875rem;
    border-collapse: separate;
    border-spacing: 0;

    &.data {
      display: table;
      td,
      th,
      tr {
        text-align: center;
      }
    }

    td,
    th {
      text-align: left;
      display: table-cell;
      word-wrap: break-word;
      padding: 0.75rem 1rem;
      line-height: 1.5;
      vertical-align: top;
      border-top: 1px solid hsla(0, 0%, 89%, 1);
      border-top: 1px solid var(--border-color);
      border-right: 0;
      border-left: 0;
      border-bottom: 0;
      border-style: solid;
    }

    tr:nth-child(2n) {
      background-color: var(--background-minor-highlight-color);
    }

    th {
      border-top: none;
    }
  }

  img {
    max-width: 100%;
  }

  div.table-container {
    overflow-x: auto;
  }

  table.full-width-table {
    width: 100%;
    display: table;
  }

  .blue-tick {
    color: $ts-main-blue-color;
    font-weight: bold;
    font-size: 1.2rem;
  }

  .black-tick {
    color: $ts-muted-green;
    font-size: 1.2rem;
  }

  .red-cross {
    color: $ts-muted-red;
    font-size: 1.2rem;
  }
}
